package com.regent.central.bill.service.bean.stock;

import com.regent.central.bill.core.storehouse.StockSku;
import com.regent.central.bill.repository.storehouse.StockSkuMapper;
import com.regent.central.bill.service.storehouse.StockSkuService;
import com.regent.central.infrastructure.service.bean.DomainServiceBean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

@Service
public class StockSkuServiceBean  extends DomainServiceBean<StockSkuMapper, StockSku> implements StockSkuService {
    /**
     * 更新库存
     * @param skuId
     * @param storehouseId
     * @param stock
     */
    @Override
    @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
    public void updateStock(String skuId, String storehouseId, BigDecimal stock) {
        mapper.updateStock(skuId,storehouseId,stock);
    }
}
